<template>
	<view class="appeal">
		<view class="black_1">
			<view class="appeal-tip">对方名称</view>
			<input class="uni-input" focus placeholder="输入对方名称" placeholder-style="font-size: 25rpx;color: #D9D9D9;" />
		</view>
		<view class="black_1">
			<view class="appeal-tip">对方电话</view>
			<input class="uni-input" focus placeholder="输入对方电话" placeholder-style="font-size: 25rpx;color: #D9D9D9;" />

		</view>

		<view class="appeal-tip appeal-tip2">申诉原因</view>
		<view >
			<textarea v-model="reason" placeholder="请输入" placeholder-style="font-size: 28rpx;color: #D9D9D9;" />
		</view>
		<view class="black_1">
			<view class="appeal-tip">上传截图</view>
			<view class="appeal-screenshot">
				<image class="add" :src="image1 =='/static/my/add_tu.png'? image1:'http://zygq.opo5.com'+image1"
					@click="chooseImage(0)"></image>
			</view>
		</view>

		<view class="appeal-submit" @click="submit()">
			<view class="appeal-submit-buttom">
				提交
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				count: 1,
				image1: '/static/my/add_tu.png',
				image2: '',
				image3: '',
				reason: '',
				images: '',
			}
		},
		onLoad(op) {
			this.id = op.id
		},
		methods: {
			chooseImage(index) {
				var that = this
				// 调用手机相机和获取相册功能
				uni.chooseImage({
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						// let formData =  {
						// 		        'time': new Date().getTime(),
						// 				'type':'buy_photo_v1',
						// 		    }
						// let that =this;
						that.http.upload(tempFilePaths[0], {}, res => {
							if (res.data) {
								that.image1 = res.data
							}
						});
					}
				});
			},
			submit() {
				var that = this


				if (this.image1 != '/static/my/add_tu.png') {
					if (!this.images) {
						this.images = this.image1
					} else {
						this.images = this.images + ',' + this.image1
					}

				}
				if (this.image2 != '') {
					if (!this.images) {
						this.images = this.image2
					} else {
						this.images = this.images + ',' + this.image2
					}
				}

				if (this.image3 != '') {
					if (!this.images) {
						this.images = this.image3
					} else {
						this.images = this.images + ',' + this.image3
					}
				}
				console.log(this.images)
				if (!this.images) {
					uni.showToast({
						title: "图片不能为空",
						icon: "none"
					})
					return
				}
				var json = {
					images: this.images,
					remark: this.reason,
					id: this.id
				}
				this.api.http.requests('exchange/appeal', json, res => {
					uni.showToast({
						title: res.msg,
						success: function() {
							setTimeout(function() {
								//要延时执行的代码
								if (res.code = 1000) {
									that.custom.tool.jump(4, 1);
								}
							}, 3000) //延迟时间 
						}
					})

				}, "POST")
			}
		}
	}
</script>

<style lang="less">
	page {
		background-color: white;
	}

	.appeal {
		margin: 10px;
	}

	.black_1 {
		display: flex;


		border-bottom: 1rpx solid #ECECEC;
		align-items: center;
		padding: 5px 0px;
		.uni-input {
			border:none
		}
	}

	.appeal-tip {
		
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

.appeal-tip2{
	margin-bottom: 10px;
	margin-top: 10px;
}
	.appeal-screenshot {
		display: flex;
		/* justify-content: center; */
	}

	.add {
		width: 80px;
		height: 80px;
		margin: 10px;

	}

	.add {
		border-radius: 10rpx;
		/* border: 1rpx dashed #AD6533; */
	}

	.appeal-submit {
		display: flex;
		justify-content: center;
		margin-top: 50rpx;

		background: #FE903D;
		/* background:url(../../static/home/btn_8.png) no-repeat; */
		/* background-size: 100% 100%,contain; */
		border-radius: 10px;
		/* color: #AD6533; */
		border: 0px solid rgba(0, 0, 0, .2);
		padding: 15px 10px 15px 10px;
		margin: 30px 30rpx 30px 30rpx;
		font-size: 35rpx;
		font-weight: 400;
		color: #FFFFFF;
	}

	textarea {
		width: 95%;
		border-radius: 5px;
		border: 1rpx solid #D9D9D9;
		/* background: #FFFAEC; */
		height: 100px;
		padding: 10px;
	}

	input {
		border-radius: 5px;
		border: 1rpx solid #D9D9D9;
		/* background: #FFFAEC; */
		height: 40px;
		padding-left: 10px;
	}
</style>